package com.ljk.controller.study;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**该类是不通过Tomcat加载spring的测试类
 * @author leng
 */
public class Client {
    public static void main(String[] args) {
        System.err.println("本方法为测试方法 by ljk");
        String xmlPath = "study/spring-context.xml";
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(xmlPath);
        // 获得personAction实例
        ExampleController exampleController = (ExampleController) applicationContext.getBean(ExampleController.class);
        exampleController.myBatisTest();



        //测试aop和从controller到dao
//        exampleController.add();
        /*try {
//            测试aop的error拦截
            exampleController.err();
        } catch (Exception e) {      }
        //测试aop的定义引介通知(方法注入)
        ((IDeclareParents) exampleController).testMethod();*/
        // getVmOperation();
    }

    /**
     * 打印当前系统参数
     */
    public static void getVmOperation() {
        String replace = System.getProperties().toString().replace(",", "\n");
        System.out.println(replace);
    }
}
